<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>一次发送多个请求</title>
</head>
<body>
<div id="app">

</div>

<script src="../../../../js/axios.js"></script>
<script type="module">
    import {createApp, onMounted} from "../../../../js/vue.esm-browser.js";

    let app = createApp(
        {
            setup() {

                function getRequest() {
                    return axios.get("https://www.httpbin.org/get?name=abcque&age=18&gender=M")
                }

                function postRequest() {
                    return axios.post(
                        "https://www.httpbin.org/post",
                        {
                            name: "xyz",
                            age: 16,
                            gender: "W",
                        })
                }

                function sendRequest() {
                    Promise.all([getRequest(), postRequest()]).then(function ([get, post]) {
                        console.log(get);
                        console.log(post);
                    })
                }

                onMounted(()=>{
                    sendRequest()
                })

                return {}
            }
        }
    )
    app.mount("#app")
</script>
</body>
</html>